
import java.util.*;


public class Test {
    class Node{
        int val;
        Node next;
        Node random;

        public Node(int val) {
            this.val = val;
        }
    }
    public Node head;
    //去重
    public static void fun1(int[]arr){
        Set<Integer>set=new TreeSet<>();
        for (int i = 0; i < arr.length; i++) {
            set.add(arr[i]);
        }
        System.out.println(set);
    }
    //找到第一个重复元素
    public static int fun2(int[]arr){
        Set<Integer>set=new TreeSet<>();
        for (int i = 0; i < arr.length; i++) {
            if(!set.contains(arr[i])){
                set.add(arr[i]);
            }else{
                return arr[i];
            }
        }
        return -1;
    }
    //统计每个数据出现的次数
    public static void fun3(int[]arr){
        Map<Integer,Integer>map=new HashMap<>();
        for (int i = 0; i < arr.length; i++) {
            if(!map.containsKey(arr[i])){
                map.put(arr[i],1);
            }else{
                map.put(arr[i],map.get(arr[i])+1);
            }
        }
        System.out.print(map);
    }

    //只出现一次的数字
    public int singleNumber(int[] nums) {
        Set<Integer>set=new HashSet<>();
        for (int i = 0; i < nums.length; i++) {
            if(!set.contains(nums[i])){
                set.add(nums[i]);
            }else {
                set.remove(nums[i]);
            }
        }
        for (int i = 0; i < nums.length; i++) {
            if(set.contains(nums[i])){
                return nums[i];
            }
        }
        return -1;
    }
    public int singleNumber1(int[] nums) {
        Map<Integer,Integer>map=new HashMap<>();
        for (int i = 0; i < nums.length; i++) {
            if(!map.containsKey(nums[i])){
                map.put(nums[i],1);
            }else {
                map.put(nums[i],map.get(nums[i])+1);
            }
        }
        for (int i = 0; i < nums.length; i++) {
            if(map.get(nums[i])==1){
                return nums[i];
            }
        }
        return -1;
    }

    //深拷贝链表
    public Node copyRandomList(Node head) {
        Node cur=head;
        Map<Node,Node>map=new HashMap<>();
        while (cur!=null){
            map.put(cur,new Node(cur.val));
            cur=cur.next;
        }
        cur=head;
        while (cur!=null){
            map.get(cur).next=map.get(cur.next);
            map.get(cur).random=map.get(cur.random);
            cur=cur.next;
        }
        return map.get(head);
    }
    //宝石与石头
    public int numJewelsInStones(String jewels, String stones) {
        Set<Character>set=new HashSet<>();
        for (char tmp:jewels.toCharArray()) {
            set.add(tmp);
        }
        int count=0;
        for (char tmp2:stones.toCharArray()) {
            if(set.contains(tmp2)){
                count++;
            }
        }
        return count;
    }
    //坏键盘
    public static void fun5(String str1,String str2){
        Set<Character>set=new HashSet<>();
        Set<Character>set1=new HashSet<>();
        for (char ch:str2.toUpperCase().toCharArray()) {
            set.add(ch);
        }
        for (char ch:str1.toUpperCase().toCharArray()) {
            if(!set.contains(ch)&&!set1.contains(ch)){
                set1.add(ch);
                System.out.print(ch);
            }
        }
    }
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        while (scanner.hasNext()){
            //期望输出的
            String str1=scanner.nextLine();
            //实际输出的
            String str2=scanner.nextLine();
            fun5(str1,str2);
        }
    }
    public static void main2(String[] args) {
        Random random=new Random();
        int[]arr=new int[10_0000];
        for (int i = 0; i < arr.length; i++) {
            arr[i]=random.nextInt(5_000);
        }
        System.out.println(fun2(arr));
        fun3(arr);
    }

    public static void main1(String[] args) {
        Set<Integer>set=new HashSet<>();
        set.add(null);
        set.add(12);
        System.out.println(set);
    }
}
